package com.tedu.web;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.ArrayList;

public class UserList extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PrintWriter out = resp.getWriter();//自己new的，不具备向客户端写出的能力
        UserDao userDao = new UserDao();
//        User user = new User();
        try{
            ArrayList<User> list = userDao.userList();
            for(User user : list){
                System.out.println(user);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {


//        out.println();
//        if(dao.checkLogin(name, password)){
//            out.println("登录成功！");
//        }else{
//            out.println("登录失败");
//        }
    }
}
